feat(docs): forge docs render — self-writing doc surfaces + one brand diagram theme - #119
Merged
Merged
Conversation
…from the registries docs check could only DETECT drift between the registries and the prose; every fix was still a human hand-editing tables across five files. This closes the loop with the marker-managed-block pattern bench already uses for reports/benchmarks.md: - README command table + GUIDE group map rendered from COMMANDS/GROUPS — the docs now show exactly the --help grouping, one source of truth. - The GUIDE MCP tool table rendered from the TOOLS registry. - Every literal "N MCP tools" count phrase auto-corrected across the six files it lives in. - One shared mermaid theme derived from brand.json (never hardcoded hexes) with the readability settings the hand-written init strings lacked — normalized across every tracked markdown file; deliberate bad-example blocks opted out via docs-check-ignore stay untouched. - A repo map in ARCHITECTURE.md drawn from the live import graph (directories sized by file count, edges = import counts), so the architecture picture cannot drift from the tree it describes. docs check gains a render reconciler: a stale registry-derived block is an ERROR whose message is the fix (run forge docs render); tree-derived output (repo map, diagram theme) is a WARNING so moving a file never fails an unrelated PR, but a new command with a stale table always does. Roots without markers manage nothing and stay ok (fixture safety). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LXmzxfRVDRVPU6LG8W39Rz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Keeping the docs in full sync with the code was manual:
forge docs checkdetects drift and fails CI, but every fix was still a human hand-editing tables across five files (the last feature PR needed the "N MCP tools" count bumped in six places by hand). And the mermaid diagrams each carried their own hand-pasted theme string.forge docs rendercloses the loop — the derivable doc surfaces are now generated from the same registries the check reads, into marker-managed blocks (the exact patternnpm run benchalready uses forreports/benchmarks.md). Prose stays human; tables and diagrams become machine-owned:COMMANDS/GROUPS, so the docs always show exactly the--helpgrouping, one source of truth.TOOLSregistry.brand.json(no hardcoded hexes) with readability settings the hand-written init strings lacked (edge label background, cluster colors, font size, curve, spacing) — normalized across every tracked markdown file; deliberate bad-example blocks opted out withdocs-check-ignorestay untouched. Change the brand → run render → every diagram re-themes.ARCHITECTURE.mddrawn from the live import graph (directories sized by file count, edges = import counts) — the architecture picture cannot drift from the tree it describes.docs checkgains arenderreconciler with calibrated severity: a stale registry-derived block is an error whose message is the fix (run forge docs render); tree-derived output (repo map, diagram theme) is a warning, so moving a file never fails an unrelated PR — but shipping a new command with a stale table always does. Roots without markers manage nothing and stay ok (fixture safety; forks can opt out by deleting markers).forge docs render --checkreports drift without writing (exit 1), for local pre-push use.Checklist
npm testpasses (1,097 pass / 0 fail locally, Node 20)npm run checkpasses (Biome lint + format)test/docs_render.test.js×9: renderer/registry coverage, splice idempotence, count rewrite, theme normalization + opt-outs, repo map from a real tree, end-to-end render → tamper → strict-drift, fixture safety)feat:/fix:/docs:…)CHANGELOG.mdupdated under## [Unreleased]forge substrate,forge impact, router/gate, or MCP substrate tools (GUIDE section fordocs render, mintlify core.mdx, COMMANDS usage/flags)Risk & rollback
COMMANDSsummaries); the only repo-wide rewrite is the mermaid%%{initline, which keeps the two brand hexesdocs checkalready enforces.Extra checks (tick if applicable)
npm run typecheckpassesdocs checkdown (try/catch → skip); missing files/markers degrade to informational🤖 Generated with Claude Code
https://claude.ai/code/session_01LXmzxfRVDRVPU6LG8W39Rz
Generated by Claude Code